package com.li.network.lab_1;

public class HttpParser {
    public static HttpRequest parse(String s) {
        HttpRequest httpRequest = new HttpRequest();
        String line1 = s.lines().findFirst().get();
        //第一行：请求方法 URL 协议版本
        String[] base = line1.split(" ");
        httpRequest.setMethod(base[0]);
        httpRequest.setUrl(base[1]);
        httpRequest.setVersion(base[2]);
        return httpRequest;
    }
}
